import {createWebHashHistory,createRouter} from 'vue-router'
import Login from '@/views/login/Login.vue'
import Layout from '@/views/layout/Layout.vue'
const routes = [
    {
        path:'/',
        redirect:'/login'
    },
    {
        path:'/login',
        component:Login
    },
    {
        path:'/layout',
        redirect:'/home',
        meta:{
            title:'首页',
            notShow:true
        },
        component:Layout,
        children:[
            {
                path:'/home',
                meta:{
                    title:'首页',
                },
                component:()=>import('@/views/home/Home.vue')
            },
        ]
    },
    {
        path:'/account',
        redirect:'/accountList',
        meta:{
            title:'账号管理',
        },
        component:Layout,
        children:[
            {
                path:'/accountList',
                meta:{
                    title:'账号列表',
                },
                component:()=>import('@/views/account/List.vue')
            },
            {
                path:'/accountAdd',
                meta:{
                    title:'添加账号',
                },
                component:()=>import('@/views/account/Add.vue')
            },
            {
                path:'/accountCenter',
                meta:{
                    title:'个人中心',
                },
                component:()=>import('@/views/account/Center.vue')
            },
            {
                path:'/accountEdit',
                meta:{
                    title:'修改密码',
                },
                component:()=>import('@/views/account/Edit.vue')
            },
        ]
    },
    {
        path:'/good',
        redirect:'/goodList',
        meta:{
            title:'商品管理',
        },
        component:Layout,
        children:[
            {
                path:'/goodList',
                meta:{
                    title:'商品列表',
                },
                component:()=>import('@/views/good/List.vue')
            },
            {
                path:'/goodAdd',
                meta:{
                    title:'商品添加',
                },
                component:()=>import('@/views/good/Add.vue')
            },
            {
                path:'/goodType',
                meta:{
                    title:'商品分类',
                },
                component:()=>import('@/views/good/Type.vue')
            },
        ]
    },
    {
        path:'/order',
        redirect:'/order1',
        meta:{
            title:'订单管理',
            notShow:true
        },
        component:Layout,
        children:[
            {
                path:'/order1',
                meta:{
                    title:'订单管理',
                },
                component:()=>import('@/views/order/Order.vue')
            },
        ]
    },
    {
        path:'/shop',
        redirect:'/shop1',
        meta:{
            title:'店铺管理',
            notShow:true
        },
        component:Layout,
        children:[
            {
                path:'/shop1',
                meta:{
                    title:'店铺管理',
                },
                component:()=>import('@/views/shop/Shop.vue')
            },
        ]
    },
    {
        path:'/statistics',
        redirect:'/statisticsGoods',
        meta:{
            title:'统计数据',
        },
        component:Layout,
        children:[
            {
                path:'/statisticsGoods',
                meta:{
                    title:'商品统计',
                },
                component:()=>import('@/views/statistics/Goods.vue')
            },
            {
                path:'/statisticsOrder',
                meta:{
                    title:'订单统计',
                },
                component:()=>import('@/views/statistics/Order.vue')
            },
        ]
    },
]
const router = createRouter({
    history:createWebHashHistory(),
    routes
})

export default router